package com.lgz.dbcourse.dto;

import com.lgz.dbcourse.util.CommonUtil;
import lombok.Getter;
import lombok.Setter;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: LGZ
 * @Date: 2021/4/28 17:06
 * @Description:
 */
@Getter
@Setter
public class MyMovie {
    private String audienceDisplay;
    private String hallName;
    private String seatCode;
    private String movieName;
    private Date startTime;

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.applyPattern("MM-dd HH:mm");
        if (startTime.after(new Date())) {
            return CommonUtil.flushLeft(' ', 20, movieName) + CommonUtil.flushLeft(' ', 5, hallName) + CommonUtil.flushLeft(' ', 20, seatCode) + sdf.format(startTime);
        }
        return CommonUtil.flushLeft(' ', 20, movieName + "（已过期)") + CommonUtil.flushLeft(' ', 5, hallName) + CommonUtil.flushLeft(' ', 20, seatCode) + sdf.format(startTime);

    }
}
